import { Controller, Post, Get, Body, Req } from '@nestjs/common'
import { MenusService } from './menus.service'

@Controller('menus')
export class MenusController {
  constructor(private menusService: MenusService) {}

  @Post('/insertMenu')
  async insertMenu(@Body() data: any) {
    return this.menusService.insertMany([data])
  }

  @Get('/findMenus')
  async findMenus(@Req() req: any) {
    return this.menusService.find(req.user)
  }

  @Post('/updateMenu')
  async updateMenu(@Body() data: any) {
    return this.menusService.updateOne(data)
  }

  @Post('/deleteMenu')
  async deleteMenu(@Body() data: any) {
    return this.menusService.deleteOne(data)
  }
}
